var gridList
    ,moduleId = RequestURLParam.getParam("moduleId");
$(document).ready(function () {
    gridList = new dataGrid("gridList");
    gridList.load({
        'moduleId': moduleId,
        'activeFlag': '1'
    });
});

//查询
function search_data() {
    gridList.reload({
        'wfFormVO.key': $('#key').val()
        , 'activeFlag': '1'
    });
}
function refresh_data(){
    $("#key").val('');
    gridList.reload({
        'wfFormVO.key': ''
        , 'activeFlag': '1'
    });
}
function formatOper(e) {
    var e = e || window.event
        ,row=e.record
        ,name = row.displayName || ''
        ,formId = row.formId
        ,btn = "<a class='layui-btn layui-btn-sm' hideFocus='' href='javascript:void(0)' onClick='doSelect(\""+formId+"\",\""+name+"\")'><i class='layui-icon'>&#xe642;</i>选择</a>";
    return btn;
}
/*
* @author: wj
* @description: 双击选择
* @date: 2019/3/9 14:27
* @param
* @return
*/
function ondbclickChooseFun(e){
    var e = e || window.event
        ,formId = e.formId
        ,formName = e.displayName;
    doSelect(formId,formName);
}
/*
* @author: wj
* @description: 选择表单
* @date: 2019/3/9 14:11
* @param
* @return
*/
function doSelect(formId,formName){
    var data = {
        formId:formId,
        formName:formName,
        // name:parentElementName
        name:geturl("name")
    };
    var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
    parent.layer.close(index); //再执行关闭
    var iframe = geturl("frameId");
    $('#'+iframe,parent.document)[0].contentWindow.changeSelectedValue(data);
    // window.parent.changeSelectedValue(data);
}